<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册 - 请假审批系统</title>
    <style>
        body {
            font-family: 'Microsoft YaHei', Arial, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            margin: 0;
            padding: 0;
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .register-container {
            background: white;
            padding: 2rem;
            border-radius: 10px;
            box-shadow: 0 10px 25px rgba(0,0,0,0.1);
            width: 100%;
            max-width: 450px;
        }
        .register-header {
            text-align: center;
            margin-bottom: 2rem;
        }
        .register-header h1 {
            color: #333;
            margin-bottom: 0.5rem;
        }
        .register-header p {
            color: #666;
            margin: 0;
        }
        .form-group {
            margin-bottom: 1rem;
        }
        .form-group label {
            display: block;
            margin-bottom: 0.5rem;
            color: #333;
            font-weight: 500;
        }
        .form-group input {
            width: 100%;
            padding: 0.75rem;
            border: 1px solid #ddd;
            border-radius: 5px;
            font-size: 1rem;
            box-sizing: border-box;
        }
        .form-group input:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
        }
        .btn-register {
            width: 100%;
            padding: 0.75rem;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 5px;
            font-size: 1rem;
            cursor: pointer;
            transition: transform 0.2s;
        }
        .btn-register:hover {
            transform: translateY(-1px);
        }
        .error-messages {
            background: #fee;
            border: 1px solid #fcc;
            color: #c66;
            padding: 1rem;
            border-radius: 5px;
            margin-bottom: 1rem;
        }
        .error-messages ul {
            margin: 0;
            padding-left: 1.5rem;
        }
        .error-messages li {
            margin-bottom: 0.5rem;
        }
        .links {
            text-align: center;
            margin-top: 1rem;
        }
        .links a {
            color: #667eea;
            text-decoration: none;
        }
        .links a:hover {
            text-decoration: underline;
        }
        .help-text {
            font-size: 0.875rem;
            color: #666;
            margin-top: 0.25rem;
        }
        .form-row {
            display: flex;
            gap: 1rem;
        }
        .form-row .form-group {
            flex: 1;
        }
    </style>
</head>
<body>
    <div class="register-container">
        <div class="register-header">
            <h1>请假审批系统</h1>
            <p>创建您的新账户</p>
        </div>

        {% if form.errors %}
            <div class="error-messages">
                {% for field, errors in form.errors.items %}
                    {% for error in errors %}
                        <p><strong>{{ field }}:</strong> {{ error }}</p>
                    {% endfor %}
                {% endfor %}
            </div>
        {% endif %}

        <form method="post">
            {% csrf_token %}

            <div class="form-group">
                <label for="{{ form.username.id_for_label }}">{{ form.username.label }}</label>
                {{ form.username }}
                {% if form.username.help_text %}
                    <div class="help-text">{{ form.username.help_text }}</div>
                {% endif %}
            </div>

            <div class="form-row">
                <div class="form-group">
                    <label for="{{ form.first_name.id_for_label }}">{{ form.first_name.label }}</label>
                    {{ form.first_name }}
                </div>
                <div class="form-group">
                    <label for="{{ form.last_name.id_for_label }}">{{ form.last_name.label }}</label>
                    {{ form.last_name }}
                </div>
            </div>

            <div class="form-group">
                <label for="{{ form.email.id_for_label }}">{{ form.email.label }}</label>
                {{ form.email }}
            </div>

            <div class="form-group">
                <label for="{{ form.password1.id_for_label }}">{{ form.password1.label }}</label>
                {{ form.password1 }}
                {% if form.password1.help_text %}
                    <div class="help-text">{{ form.password1.help_text }}</div>
                {% endif %}
            </div>

            <div class="form-group">
                <label for="{{ form.password2.id_for_label }}">{{ form.password2.label }}</label>
                {{ form.password2 }}
                {% if form.password2.help_text %}
                    <div class="help-text">{{ form.password2.help_text }}</div>
                {% endif %}
            </div>

            <button type="submit" class="btn-register">注册</button>
        </form>

        <div class="links">
            <a href="{% url 'login' %}">已有账户？立即登录</a>
        </div>
    </div>
</body>
</html>
